Skip to main content
Version: legacy

Media Messages

Enterprise can send messages containing images, videos and documents to his customers.

Before You Start
You need to meet all the prerequisites listed in the Before You Start section of the documentation.

Step 1: Make POST Request

Image Message

Parameters:

NameDescriptionJSON TypeDefaultConstraintsRequired
typeConstant value media.StringN/AmediaYes
mediaUrlPublic url of the image file. Should be either HTTP or HTTPS link.StringN/AN/AYes
captionCaption that will be displayed underneath the image.StringNone1024 CharactersNo
contentTypeFormat of media file.StringNoneimage/jpegYes

Payload: image

{
"messages": [
{
"sender": "918882XXXXXX",
"to": "919999XXXXXX",
"messageId": "xxxxx",
"transactionId": "dsfsdfdfadgdfhh69665fd6",
"callbackDlrUrl": "http://xxx.com",
"channel": "wa",
"type": "media",
"media": {
"contentType": "image/jpeg",
"caption": "Hi",
"mediaUrl": "https://sample-videos.com/img/Sample-jpg-image-100kb.jpg"
}
}
],
"responseType": "json"
}

Note: Any image media file sent through the Sinch WhatsApp API can be atmost be 5 MB after processing.

Video Message

Parameters:

NameDescriptionJSON TypeDefaultConstraintsRequired
typeConstant value media.StringN/AmediaYes
mediaUrlPublic url of the video file (mp4). Should be either HTTP or HTTPS link.StringN/AN/AYes
captionCaption that will be displayed underneath the video.StringNone1024 charactersNo
contentTypeFormat of media file.StringNoneVideo/mp4Yes

Payload: video

{
"messages": [
{
"sender": "918882XXXXXX",
"to": "919999XXXXXX",
"messageId": "xxxxx",
"transactionId": "dsfsdfdfadgdfhh69665fd6",
"callbackDlrUrl": "http://xxx.com",
"channel": "wa",
"type": "media",
"media": {
"contentType": "image/jpeg",
"caption": "Hi",
"mediaUrl": "https://sample-videos.com/img/Sample-jpg-image-100kb.jpg"
}
}
],
"responseType": "json"
}

Note: Any video media file sent through the Sinch WhatsApp API can be atmost 16 MB after processing.

Document Message

Parameters:

NameDescriptionJSON TypeDefaultConstraintsRequired
typeConstant value media.StringN/AmediaYes
mediaUrlPublic url of the document file. Should be either HTTP or HTTPS link.StringN/AN/AYes
contentTypeFormat of media file.StringNoneapplication/pdf, application/zipYes
captionCaption that will be displayed as the document title.StringNone1024 charactersNo

Payload: document pdf

{
"messages": [
{
"sender": "918010XXXXXX",
"to": "919999XXXXXX",
"messageId": "",
"transactionId": "",
"callbackDlrUrl": "http://xxx.com",
"channel": "wa",
"type": "media",
"media": {
"contentType": "application/pdf",
"caption": "Hi",
"mediaUrl": "https://sample-file.com/pdf/Sample-file.pdf"
}
}
],
"responseType": "json"
}

Payload: document zip

{
"messages": [
{
"sender": "918010XXXXXX",
"to": "919999XXXXXX",
"messageId": "",
"transactionId": "",
"callbackDlrUrl": "http://xxx.com",
"channel": "wa",
"type": "media",
"media": {
"contentType": "application/zip",
"caption": "Hi",
"mediaUrl": "https://sample-videos.com/zip/abc.zip"
}
}
],
"responseType": "json"
}

Note: Any document media file sent through the Sinch WhatsApp API can be atmost 100 MB after processing.

Step 2: Check Your Response
The response example shows a sample response from the API request: Possible elements in responses includes,

  • Success Response
    Payload
{
"success": true,
"responseId": "1606887827245734233232332"
}

Note : Calback URL is a optional paramter . Please use when you want to change the default URL(configured through smartta). It will only chnage the domain name othere paratemters will be same as configurated in smartta.